#ifndef __MY_CAN_H__
#define __MY_CAN_H__

#include "main.h"
#include "can.h"


void vApp_CAN_TxMessage(CAN_HandleTypeDef *hcan,
                        CAN_TxHeaderTypeDef *pTxHeader,
                        uint32_t Stdid,
                        uint8_t *aData,
                        uint8_t DLC);

void vApp_CAN_TxHeader_Init(CAN_TxHeaderTypeDef *pHeader,
                            uint32_t StdId,
                            uint32_t ExtId,
                            uint32_t IDE,
                            uint32_t RTR,
                            uint32_t DLC);

void vApp_CAN_Filter_Init(CAN_FilterTypeDef *pFilter,
                          uint32_t IdHigh,
                          uint32_t IdLow,
                          uint32_t MaskIdHigh,
                          uint32_t MaskIdLow,
                          uint32_t FIFOAssignment,
                          uint32_t Bank,
                          uint32_t Mode,
                          uint32_t Scale,
                          uint32_t Activation,
                          uint32_t SlaveStartFilterBank);

//标准帧滤波器初始化
void vApp_CAN_Filter_Init_IDMASK(CAN_FilterTypeDef *pFilter,
                                 uint32_t Bank, //滤波器编号
                                 uint32_t id    //允许通过的ID，0的时候允许所有
);

void CAN_Filter_set(CAN_HandleTypeDef *phcan,
                    CAN_FilterTypeDef *pFilter,
                    uint32_t Bank, //滤波器编号
                    uint32_t id    //允许通过的ID，0的时候允许所有

);
void CAN_StarCAN(CAN_HandleTypeDef *hcan);
void Processing_CAN1(CAN_RxHeaderTypeDef can_RxHeader,uint8_t *can_RxData);
uint8_t vApp_CAN_TxMessage2(CAN_HandleTypeDef *hcan, CAN_TxHeaderTypeDef *pTxHeader, uint32_t Stdid, uint8_t *aData, uint8_t DLC);
extern CAN_TxHeaderTypeDef can_TxHeader;
extern CAN_FilterTypeDef Filter;

#endif